package com.chinacache.maint.workorder.entity;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.chinacache.maint.commons.entity.BaseEntity;

@Entity
@Table(name = "WO_FLOWCLASS")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class FlowClass extends BaseEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String name;
	private String memo;
	private Set<Flow> flows = new LinkedHashSet<Flow>(0);
	private Set<WorkOrder> workOrder = new LinkedHashSet<WorkOrder>(0);

	@OneToMany(mappedBy = "flowClass")
	public Set<WorkOrder> getWorkOrder() {
		return workOrder;
	}

	public void setWorkOrder(Set<WorkOrder> workOrder) {
		this.workOrder = workOrder;
	}

	@Id
	@Column(name = "FLOWCLASS_ID")
	@GeneratedValue(generator = "SEQ_RPT_USER_TO_CLASS")
	@GenericGenerator(name = "SEQ_RPT_USER_TO_CLASS", strategy = "seqhilo", parameters = { @Parameter(name = "sequence", value = "SEQ_RPT_USER_TO_CLASS") })
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "MEMO")
	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@OneToMany(mappedBy = "flowClass")
	public Set<Flow> getFlows() {
		return flows;
	}

	public void setFlows(Set<Flow> flows) {
		this.flows = flows;
	}
}
